<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Set or alter parser options</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.bbcode-set-arg-parser.html">bbcode_set_arg_parser</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.pcre.html">PCRE</a></div>
 <div class="up"><a href="ref.bbcode.html">BBCode 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.bbcode-set-flags" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">bbcode_set_flags</h1>
  <p class="verinfo">(PECL bbcode &gt;= 0.10.2)</p><p class="refpurpose"><span class="refname">bbcode_set_flags</span> &mdash; <span class="dc-title">Set or alter parser options</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.bbcode-set-flags-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>bbcode_set_flags</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$bbcode_container</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = BBCODE_SET_FLAGS_SET</span></span>
  ] )</div>


  <p class="para rdfs-comment">
   Set or alter parser options
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.bbcode-set-flags-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">bbcode_container</code></em></dt>

     <dd>

      <p class="para">
       BBCode_Container resource, returned by <span class="function"><a href="function.bbcode-create.html" class="function">bbcode_create()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">flags</code></em></dt>

     <dd>

      <p class="para">
       The flag set that must be applied to the bbcode_container options 
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">mode</code></em></dt>

     <dd>

      <p class="para">
       One of the BBCODE_SET_FLAGS_* constant to set, unset
       a specific flag set or to replace the flag set by flags.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.bbcode-set-flags-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-function.bbcode-set-flags-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4681">
    <p><strong>Example #1 <span class="function"><strong>bbcode_set_flags()</strong></span> usage example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*<br />&nbsp;*&nbsp;Preparing&nbsp;RuleSet<br />&nbsp;*/<br /></span><span style="color: #0000BB">$arrayBBCode</span><span style="color: #007700">=array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'b'</span><span style="color: #007700">=&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'type'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">BBCODE_TYPE_NOARG</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'open_tag'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'&lt;b&gt;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'close_tag'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'&lt;/b&gt;'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'u'</span><span style="color: #007700">=&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'type'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">BBCODE_TYPE_NOARG</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'open_tag'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'&lt;u&gt;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'close_tag'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'&lt;/u&gt;'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'i'</span><span style="color: #007700">=&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'type'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">BBCODE_TYPE_NOARG</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'open_tag'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'&lt;i&gt;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'close_tag'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'&lt;/i&gt;'</span><span style="color: #007700">),<br />);<br /></span><span style="color: #FF8000">/*<br />&nbsp;*&nbsp;Paired&nbsp;incorrectly&nbsp;nested&nbsp;BBCode&nbsp;<br />&nbsp;*/<br /></span><span style="color: #0000BB">$text</span><span style="color: #007700">=</span><span style="color: #DD0000">"[i]&nbsp;Parser&nbsp;[b]&nbsp;Auto&nbsp;Correction&nbsp;[/i]&nbsp;at&nbsp;work&nbsp;[/b]\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$BBHandler</span><span style="color: #007700">=</span><span style="color: #0000BB">bbcode_create</span><span style="color: #007700">(</span><span style="color: #0000BB">$arrayBBCode</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">bbcode_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$BBHandler</span><span style="color: #007700">,</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;Enabling&nbsp;reopening&nbsp;of&nbsp;automatically&nbsp;closed&nbsp;elements<br /></span><span style="color: #0000BB">bbcode_set_flags</span><span style="color: #007700">(</span><span style="color: #0000BB">$BBHandler</span><span style="color: #007700">,</span><span style="color: #0000BB">BBCODE_CORRECT_REOPEN_TAGS</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">BBCODE_SET_FLAGS_SET</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">bbcode_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$BBHandler</span><span style="color: #007700">,</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*<br />&nbsp;*&nbsp;Unpaired&nbsp;incorrectly&nbsp;nested&nbsp;BBCode&nbsp;<br />&nbsp;*/<br /></span><span style="color: #0000BB">$text</span><span style="color: #007700">=</span><span style="color: #DD0000">"[i]&nbsp;Parser&nbsp;[b]&nbsp;Auto&nbsp;Correction&nbsp;[/i]&nbsp;at&nbsp;work\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">bbcode_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$BBHandler</span><span style="color: #007700">,</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;Enabling&nbsp;automatic&nbsp;close&nbsp;of&nbsp;pending&nbsp;tags<br /></span><span style="color: #0000BB">bbcode_set_flags</span><span style="color: #007700">(</span><span style="color: #0000BB">$BBHandler</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">BBCODE_CORRECT_REOPEN_TAGS</span><span style="color: #007700">|</span><span style="color: #0000BB">BBCODE_AUTO_CORRECT</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">BBCODE_SET_FLAGS_SET</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">bbcode_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$BBHandler</span><span style="color: #007700">,</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
&lt;i&gt; Parser &lt;b&gt; Auto Correction &lt;/b&gt;&lt;/i&gt; at work 
&lt;i&gt; Parser &lt;b&gt; Auto Correction &lt;/b&gt;&lt;/i&gt;&lt;b&gt; at work &lt;/b&gt;
&lt;i&gt; Parser [b] Auto Correction &lt;/i&gt; at work
&lt;i&gt; Parser &lt;b&gt; Auto Correction &lt;/b&gt;&lt;/i&gt;&lt;b&gt; at work
&lt;/b&gt;
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.bbcode-set-arg-parser.html">bbcode_set_arg_parser</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.pcre.html">PCRE</a></div>
 <div class="up"><a href="ref.bbcode.html">BBCode 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
